# Realize, that this isn't at the level of abstraction or flexibility that
#  it needs to be.  I think instead of overwhelming you with too many smart
#  programming practices all at once, that it would be better to wean you 
#  away from your PHP poison slowly.
#
# E.g., select_class will actually be a class and we will do more validation
#  with user input.  In general, large blocks of nonsense will be split 
#  into smaller, logical chunks and grouped in to classes.

from __future__ import absolute_import

import input

from attributes import classes

#===============================================================================

def select_class():
    #print "There are two races at battle in this world\n"
    print "List of classes:"
    #class_list = ["Soldier", "Scout", "Mage", "Healer", "Spy", "Politician"]

    for item in class_dict.keys():
        print "\t", item.capitalize()
    print

    #if classes == "Chuck Norris":
    #    print "OMG You are epic"

    selection = input.decision("Please choose a class:", class_dict.keys())
    class_ = class_dict[selection]

    if class_['specialties'] != None:
        print "The following specialties are available for your class:"

        for item in class_['specialties']:
            print "\t", item.title()
        print

        selection = input.decision("Please choose a specialty: ", class_['specialties'].keys())

        speciality = class_['specialties'][selection]
        class CustomClass(speciality, class_['class']): pass
        return CustomClass()
    else:
        return class_()


def introduction():
    format_list = ["/" * 40, "",
                   "RPG Game - [Micro]soft",
                   "Created by Jack",
                   "Have fun",
                   "", "/"*40]

    for text in format_list:
        print '    //{0:^40}//'.format(text)
    else:
        print

    #name = raw_input("Enter in your name: ")
    intro = "Welcome, %(name), to the post-apocolyptic nightmare that is " + \
    "the land of Fail.\nThis is a world of magic and machinery, where " + \
    "the native humans are fighting the alien invaders and life has " + \
    "become a constant struggle..." # % {'name':name}

def main():
    introduction()
    # We would have to return name from introduction() if we put name in there
    #  so it would be wise to re-think how this works.
    character = select_class()

    # Testing MRO
    #class CustomClass(Ranged, Soldier): pass
    #character = CustomClass()

    # Demonstrate working MRO
    print character.name, character.specialty_name

    # Small problem with using CustomClass; but this can/will be fixed with some __repr__ magikz later.
    print character

if __name__ == "__main__":
    main()
